﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaEngine.Graphics;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace FXnaEngine
{

    /// <summary>
    /// 提高一个较为复杂的模型复写例子
    /// </summary>
    public class FRoadModel : FProviderModel
    {


        public FRoadModel()
        {
            this.trackLine = new FTrackLine();

            this.trackLine.BuildMesh();

 
        }


        #region props

      

        FTrackLine trackLine;


        FMaterial roadMaterial = new FMaterial(
           );

        public FMaterial RoadMaterial
        {
            get { return roadMaterial; }
            set { roadMaterial = value; }
        }


        /// <summary>
        /// Road back material, for the other side of the road and the sides.
        /// </summary>
        FMaterial roadBackMaterial = new FMaterial(
            );

        public FMaterial RoadBackMaterial
        {
            get { return roadBackMaterial; }
            set { roadBackMaterial = value; }
        }





        #endregion



        public override void RenderCore(FGraphicsSystem graphics, Components.FRendererComponent renderer)
        {
            base.RenderCore(graphics, renderer);



     ;
            //basicEffect.Texture = material.Texture;



            Matrix roadWorld = renderer.ParentEntity.Transform.WorldMatrix;

     

  



            graphics.ShaderBasic.SetParameters(this.roadMaterial, roadWorld);

            graphics.RenderWithEffect(trackLine.InnerMesh, graphics.ShaderBasic.BasicEffect);











        }


        public override void ResetMeshes()
        {
            base.ResetMeshes();



        }
        


    }


}
